package CodeOne;

import java.util.Scanner;

/** @author ASUS */
public class Datagram {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int month = 0, day = 0;
    while (scan.hasNextInt()) {
      // 年份
      int year = scan.nextInt();
      // 第几天
      int num = scan.nextInt();
      boolean isLeapYear = true;
      if (year % 4 != 0 && year % 100 != 0) {
        isLeapYear = false;
      }
      // 是闰年
      if (isLeapYear) {
        // 闰年数组初始化
        int[] date = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        for (int i = 0; i < date.length; i++) {
          if (num > date[i]) {
            num -= date[i];
          } else {
            day = num;
            month = i + 1;
            break;
          }
        }
        // 不是闰年
      } else {
        // 平年数组初始化
        int[] date = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        for (int i = 0; i < date.length; i++) {
          if (num > date[i]) {
            num -= date[i];
          } else {
            day = num;
            month = i + 1;
            break;
          }
        }
      }
      System.out.printf("%d-%02d-%02d", year, month, day);
    }
    scan.close();
  }
}
